// 获取id
let url=decodeURI(window.location.href);
console.log(url);
var cs=url.split("?")[1].split("=");
console.log(cs);
var csKey=cs[0].toLowerCase()
var csvalue=+cs[1];
let o ={[csKey]:csvalue};
console.log(o);
// 获取数据进行渲染
var product=document.querySelector("#product");
var comment=document.querySelector(".comment")
let xhr1=new XMLHttpRequest();
 xhr1.open("get","http://chst.vip:1234/api/getmoneyctrlproduct?productid="+csvalue,true);
 xhr1.onload=function(){
     let lis1="";
     let lis2="";
     if(xhr1.status===200){
         let res1=JSON.parse(xhr1.responseText);
         let x=res1.result[0]
         console.log(x);
         let regExp = /(?<=imgurl=)[^'"]*/;
         let imgsrc = res1.result[0].productImgSm.match(regExp)[0];
         let imgsrc2 = res1.result[0].productImg2.match(regExp)[0];
         console.log(imgsrc);
         lis1=`
                    <ul class="info">
                    <li class="infoa">
                                        <div class="title">
                                        <h4>${x.productName}</h4>
                                        </div>
                                        <div class="other">
                                                            <span>${x.productFrom}|${x.productTime}</span>
                                                            <i>${x.productTips}</i>
                                        </div>
                                        <div class="container">
                                                            <p>
                                                            <img src="${imgsrc}" alt="">
                                                            ${x.productInfo}${x.productInfo1}
                                                            </p>
                                        </div>
                                        <div class="bigimg">
                                                            
                                                                <img src="${imgsrc2}" alt="">
                                        </div>
                                        <div class="city">
                                                            ${x.productCity}
                                        </div>
                                        
                    </li>          
                    </ul>
         `
         lis2=`
              ${x.productComment}
         `
}
product.innerHTML=lis1;
comment.innerHTML=lis2
}
xhr1.send();
